package com.yc.springmvc.bean;

import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.util.List;

@Data
public class Movie implements java.io.Serializable {
    private Integer id;
    @NotBlank(message = "片名不能为空")
    @Size(min=2,max = 20,message = "片名必须是2~20个字符")
    private String name;
    @Range(min = 30, max = 600, message = "片长必须是 30~600 分钟")
    private Integer length;
    private String type;
    @Past  // 过去的时间
    private Timestamp beginTime;
    @Future // 未来的时间
    private Timestamp endTime;
    private Boolean is3d;
    private String intro;
    @Pattern(regexp="[/\\w]+\\.\\w+")
    @Size(min = 5, max = 100, message = "图片地址长度必须在 5~100 个字符之间!")
    private String image;

    // 一对多关联
    private List<Plan> plans;
}
